<?php

namespace App;

class Game
{
	public $players;
	
	public function __construct()
	{
		$this->players = array();
	}
	
	public function addPLayer($id = 0)
	{
		if(!$id) return false;
		
		$player = new Player($id);
		$this->players[$id] = $player;
		
		return $player;
	}
	
	public function removePlayer($id = 0)
	{
		if(!$id) return false;
		
		unset($this->players[$id]);
	}
	
	/**
	 * Deprecated
	 */
	public function getPlayer($id = 0)
	{
		if(!$id) return false;
		
		foreach($this->players as &$player)
		{
			if($player->id == $id) return $player;
		}
		
		return false;
	}

	public function setPlayerPosition($id, $x, $y)
	{
		
	}
}

?>